package com.yunnuo.systool.code.controller;

import com.yunnuo.systool.code.CommonEnum;
import com.yunnuo.systool.code.utils.ToolUtil;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 代码生成Controller
 * Created by w_weihf on 2018/12/19.
 */
@Controller
@RequestMapping("/systool/code")
public class CodeController {

    private String prefix = "/systool/code";

    @RequiresPermissions("systool:code:view")
    @GetMapping()
    public String code(Model model)
    {
        model.addAttribute("basic", DefaultValue.getBasic());
        model.addAttribute("fieldList", DefaultValue.fieldList());
        model.addAttribute("fieldType", ToolUtil.enumToMap(CommonEnum.FieldType.class));
        model.addAttribute("fieldQuery", ToolUtil.enumToMap(CommonEnum.FieldQuery.class));
        model.addAttribute("fieldVerify", ToolUtil.enumToMap(CommonEnum.FieldVerify.class));
        return prefix + "/index";
    }
}
